<template>
	<view class="ground">
		<view class="post imgPublic">
			<image :src="datas.poster" mode='widthFix'></image>
		</view>
		<view class="btns" @tap='goPage' v-if="datas.poster_button_name">{{datas.poster_button_name}}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				forms_id:'',
				datas:{},
			};
		},
		onLoad(e) {
			this.forms_id = e.forms_id?e.forms_id:'';
		},
		onShow(){
			this.initSettle()
		},
		onShareAppMessage() {
			this.tool.monitor();
			return {
				title:'加一精选',
				path:'/pages/seller',
				imageUrl:'https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/logo.png',
				desc:'这里有众多优质好物等您来选择',
			} 
		},
		onShareTimeline() {
			this.tool.monitor();
			let share = {
				title:'加一精选',
				path:'/pages/seller',
				imageUrl:'https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/logo.png',
				desc:'这里有众多优质好物等您来选择',
			}
			return share;
		},
		methods:{
			initSettle(){
				this.tool.getData('/api/forms/getFormsInfo',{
					forms_id:this.forms_id
				}).then(res=>{
					console.log(res);
					if(res){
						uni.setNavigationBarTitle({
							title:res.name,
						})
						this.datas = res;
					}
				}).catch(err=>{
					console.log(err);
				})
			},
			// 页面跳转
			goPage(){
				uni.navigateTo({
					url:'./settle?forms_id='+this.forms_id,
				})
			}
		}
	}
</script>

<style lang="scss">
	.ground{
		position: relative;
		width: 100%;
		.btns{
			width: 84%;
			left: 8%;
			position: fixed;
			bottom: 45px;
			text-align: center;
			border-radius: 40px;
			padding: 11px 0;
			background: $col_active;
			color: white;
			font-size: 16px;
		}
	}
</style>
